<template>
	<view>
		<el-tabs v-model="activeName" @tab-click="handleClick"  class="equal-width-tabs" >
		   <el-tab-pane label="已受理" name="1">
			   <complaint :list-data='GetComplaint'></complaint>
		   </el-tab-pane>
		   <el-tab-pane label="未受理" name="0">
			   <complaint :list-data='GetComplaint'></complaint>
		   </el-tab-pane>
		 </el-tabs>
		 </view>
</template>
<script>
	import complaint from '../../pages/components/Complaint-msg'
	export default {
		components: {
			complaint,
		},
		data() {
			return {
				activeName: '1',
				Token:{
					"token":'',
					"status":''
				},
				GetComplaint:{
					
				}
				
			}
		},
		
		onLoad() {
			this.Token.token=uni.getStorageSync('login-user').token;
			this.handleClick(1);
		},

		methods: {
			handleClick(tab, event) {
				if(tab.name==0)
							this.Token.status=0;
				else
				this.Token.status=1;
							console.log(this.Token.status);
							
								uni.request({
								 	url:'http://192.168.2.226:8086/business/user/mycomplaint',
								 	method:'GET',
									header: {
									        'token': this.Token.token // 在这里设置请求头
									    },
									data:{
										"status":this.Token.status,
									},
								 	// 返回成功的结果
								 	success:(res)=>{	
									this.GetComplaint = res.data.data;	
									},
								 	fail() {
								 		console.log("获取失败")
								 	},
								 })
							

						
			},
			
		}
	}
</script>

<style>
	.content {
		width: 100%;
		height: 200px;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		background-color: bisque;
	}
	
	::v-deep.equal-width-tabs .el-tabs__header {
	width: 100%;
	margin-left: 0px;
	display: flex;
	justify-content: space-around; /* 保持不变 */	  
	}
	
	::v-deep .equal-width-tabs .el-tabs__item {
	  flex-grow: 1;
	  text-align: center; /* 确保标签文本居中 */
	  max-width: none !important; /* 重写 Element UI 的最大宽度限制 */
	}
	::v-deep .el-tabs__item.is-active {
	    color: #15cbf3;
	  }
	  
	::v-deep .el-icon-arrow-left {
	      color: white;
	    }
	::v-deep .el-icon-arrow-right {
	      color: white;
	    }
	::v-deep .el-tabs__nav-wrap::after {
	      height: 0;
	    }
	::v-deep .el-tabs__active-bar {
	      background-color: #15cbf3;
	    }
	
	
</style>

